﻿namespace PMS.Client.FrmUser
{
    using FastReport;
    using PMS.BLL;
    using PMS.Client.Controls;
    using PMS.Common;
    using PMS.Model;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Drawing.Printing;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    public class FrmReport : Form
    {
        private DataGridViewTextBoxColumn AdminPosition;
        private DataGridViewTextBoxColumn Birthplace;
        private Button btnPrint;
        private ComboBox cbReportList;
        private List<string> columnList = new List<string>();
        private IContainer components = null;
        private DataGridViewTextBoxColumn Degree;
        private List<DataGridViewColumn> dgvColumnList = new List<DataGridViewColumn>();
        private DataGridViewTextBoxColumn GraduationDate;
        private DataGridViewTextBoxColumn GraduationSchoole;
        private DataGridViewTextBoxColumn HighestEducation;
        private DataGridViewTextBoxColumn IsHeighWith;
        private DataGridViewTextBoxColumn IsLeave;
        private DataGridViewTextBoxColumn IsOffice;
        private DataGridViewTextBoxColumn JobPositionDate;
        private DataGridViewTextBoxColumn JobPositionDate1;
        private DataGridViewTextBoxColumn JobPositionDate2;
        private DataGridViewTextBoxColumn JobPositionName1;
        private DataGridViewTextBoxColumn JobPositionName2;
        private DataGridViewTextBoxColumn JobPositionNo;
        private DataGridViewTextBoxColumn JobPositionRemark;
        private DataGridViewTextBoxColumn JobPositionSummary;
        private DataGridViewTextBoxColumn JobPositionType;
        private DataGridViewTextBoxColumn JobTitle1;
        private DataGridViewTextBoxColumn JobTitle2;
        private DataGridViewTextBoxColumn JoinPartDate;
        private DataGridViewTextBoxColumn JoinWorkDate;
        private Label label1;
        private Label lbDate;
        private Label lbOrganName;
        private Label lbTel;
        private Label lbTtile;
        private Label lbUser;
        private DataGridViewTextBoxColumn LeaveDate;
        private DataGridViewTextBoxColumn LeaveDay;
        private DataGridViewTextBoxColumn LeaveNo;
        private DataGridViewTextBoxColumn LeaveReasion;
        private DataGridViewTextBoxColumn LeaveRemark;
        private DataGridViewTextBoxColumn LeaveTo;
        private DataGridViewTextBoxColumn Major;
        private DataGridViewTextBoxColumn Nation;
        private Organ organ = null;
        private int OrganID = 0;
        private Panel panel1;
        private Panel panel3;
        private DataGridViewTextBoxColumn Politics;
        private DataGridViewTextBoxColumn Position1;
        private DataGridViewTextBoxColumn Position2;
        private DataGridViewTextBoxColumn PositionDate1;
        private DataGridViewTextBoxColumn PositionDate2;
        private DataGridViewTextBoxColumn PositionEndDate1;
        private DataGridViewTextBoxColumn PositionEndDate2;
        private DataGridViewTextBoxColumn PositionLevel1;
        private DataGridViewTextBoxColumn PositionLevel2;
        private DataGridViewTextBoxColumn PositionNo1;
        private DataGridViewTextBoxColumn PositionNo2;
        private DataGridViewTextBoxColumn PositionRemark1;
        private DataGridViewTextBoxColumn PositionRemark2;
        private DataGridViewTextBoxColumn PositionStartDate1;
        private DataGridViewTextBoxColumn PositionStartDate2;
        private PrintDocument printDoc = new PrintDocument();
        private DataGridViewTextBoxColumn RegistDate;
        private DataGridViewTextBoxColumn RegistDay;
        private DataGridViewTextBoxColumn RegistFrom;
        private DataGridViewTextBoxColumn RegistNo;
        private DataGridViewTextBoxColumn RegistRemark;
        private DataGridViewTextBoxColumn RegistState;
        private DataGridViewTextBoxColumn RegistSummary;
        private DataGridViewTextBoxColumn RegistTo;
        private DataGridViewTextBoxColumn RegistType;
        private DataGridViewTextBoxColumn RegistWay;
        private UserReport report = null;
        private List<UserReport> reportList = null;
        private DataGridViewTextBoxColumn Sex;
        private UCDataGridView ucDataGridView1;
        private UserBLL userbll = new UserBLL();
        private DataGridViewTextBoxColumn UserID;
        private List<User> userlist = null;
        private DataGridViewTextBoxColumn UserName;

        public FrmReport(int OrganID)
        {
            this.InitializeComponent();
            foreach (DataGridViewColumn column in this.ucDataGridView1.Columns)
            {
                this.dgvColumnList.Add(column);
            }
            this.ucDataGridView1.AutoGenerateColumns = false;
            this.OrganID = OrganID;
            this.organ = new OrganBLL().GetModel(OrganID);
            if (this.organ != null)
            {
                this.reportList = new UserReportBLL().GetList(this.organ.IsOffice);
            }
            if (this.reportList != null)
            {
                this.cbReportList.DataSource = this.reportList;
                this.cbReportList.DisplayMember = "ReportName";
                this.cbReportList.ValueMember = "ReportID";
                this.cbReportList.SelectedIndex = 0;
                this.ReportDataBind();
            }
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {
            FastReport.Report report = new FastReport.Report();
            report.Load(Application.StartupPath + @"\ReportTemplates\user.frx");
            List<UserReport> data = new List<UserReport> {
                this.report
            };
            List<ColumnName> list2 = new List<ColumnName>();
            foreach (DataGridViewColumn column in this.ucDataGridView1.Columns)
            {
                if (column.Name != "UserID")
                {
                    ColumnName item = new ColumnName {
                        Name = column.Name,
                        Text = column.HeaderText
                    };
                    list2.Add(item);
                }
            }
            report.Parameters.FindByName("OrganName").Value = this.organ.OrganName;
            report.RegisterData(data, "report");
            report.RegisterData(list2, "columnNameList");
            report.RegisterData(this.userlist, "userlist");
            try
            {
                report.FileName = this.organ.OrganName + this.report.ReportName + "_" + DateTime.Now.ToString("yyyyMMdd");
                report.Print();
            }
            catch (Exception exception)
            {
                Log.Write(exception.Message);
                MessageBox.Show("未安装打印机或打印服务未开启！");
            }
        }

        private void cbReportList_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.ReportDataBind();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.components = new Container();
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            this.panel1 = new Panel();
            this.btnPrint = new Button();
            this.cbReportList = new ComboBox();
            this.label1 = new Label();
            this.panel3 = new Panel();
            this.lbDate = new Label();
            this.lbTel = new Label();
            this.lbUser = new Label();
            this.lbOrganName = new Label();
            this.lbTtile = new Label();
            this.ucDataGridView1 = new UCDataGridView(this.components);
            this.UserID = new DataGridViewTextBoxColumn();
            this.UserName = new DataGridViewTextBoxColumn();
            this.Sex = new DataGridViewTextBoxColumn();
            this.Birthplace = new DataGridViewTextBoxColumn();
            this.Nation = new DataGridViewTextBoxColumn();
            this.Politics = new DataGridViewTextBoxColumn();
            this.JoinPartDate = new DataGridViewTextBoxColumn();
            this.GraduationDate = new DataGridViewTextBoxColumn();
            this.GraduationSchoole = new DataGridViewTextBoxColumn();
            this.HighestEducation = new DataGridViewTextBoxColumn();
            this.Degree = new DataGridViewTextBoxColumn();
            this.Major = new DataGridViewTextBoxColumn();
            this.JoinWorkDate = new DataGridViewTextBoxColumn();
            this.IsOffice = new DataGridViewTextBoxColumn();
            this.RegistWay = new DataGridViewTextBoxColumn();
            this.RegistDay = new DataGridViewTextBoxColumn();
            this.RegistFrom = new DataGridViewTextBoxColumn();
            this.RegistTo = new DataGridViewTextBoxColumn();
            this.RegistNo = new DataGridViewTextBoxColumn();
            this.RegistDate = new DataGridViewTextBoxColumn();
            this.RegistSummary = new DataGridViewTextBoxColumn();
            this.RegistRemark = new DataGridViewTextBoxColumn();
            this.RegistState = new DataGridViewTextBoxColumn();
            this.RegistType = new DataGridViewTextBoxColumn();
            this.IsHeighWith = new DataGridViewTextBoxColumn();
            this.JobPositionType = new DataGridViewTextBoxColumn();
            this.JobPositionName1 = new DataGridViewTextBoxColumn();
            this.JobPositionName2 = new DataGridViewTextBoxColumn();
            this.JobPositionDate1 = new DataGridViewTextBoxColumn();
            this.JobPositionDate2 = new DataGridViewTextBoxColumn();
            this.JobPositionNo = new DataGridViewTextBoxColumn();
            this.JobPositionDate = new DataGridViewTextBoxColumn();
            this.JobPositionSummary = new DataGridViewTextBoxColumn();
            this.JobPositionRemark = new DataGridViewTextBoxColumn();
            this.AdminPosition = new DataGridViewTextBoxColumn();
            this.Position1 = new DataGridViewTextBoxColumn();
            this.Position2 = new DataGridViewTextBoxColumn();
            this.PositionLevel1 = new DataGridViewTextBoxColumn();
            this.PositionLevel2 = new DataGridViewTextBoxColumn();
            this.PositionStartDate1 = new DataGridViewTextBoxColumn();
            this.PositionStartDate2 = new DataGridViewTextBoxColumn();
            this.PositionEndDate1 = new DataGridViewTextBoxColumn();
            this.PositionEndDate2 = new DataGridViewTextBoxColumn();
            this.JobTitle1 = new DataGridViewTextBoxColumn();
            this.JobTitle2 = new DataGridViewTextBoxColumn();
            this.PositionNo1 = new DataGridViewTextBoxColumn();
            this.PositionNo2 = new DataGridViewTextBoxColumn();
            this.PositionDate1 = new DataGridViewTextBoxColumn();
            this.PositionDate2 = new DataGridViewTextBoxColumn();
            this.PositionRemark1 = new DataGridViewTextBoxColumn();
            this.PositionRemark2 = new DataGridViewTextBoxColumn();
            this.IsLeave = new DataGridViewTextBoxColumn();
            this.LeaveReasion = new DataGridViewTextBoxColumn();
            this.LeaveDay = new DataGridViewTextBoxColumn();
            this.LeaveTo = new DataGridViewTextBoxColumn();
            this.LeaveNo = new DataGridViewTextBoxColumn();
            this.LeaveDate = new DataGridViewTextBoxColumn();
            this.LeaveRemark = new DataGridViewTextBoxColumn();
            this.panel1.SuspendLayout();
            this.panel3.SuspendLayout();
            ((ISupportInitialize) this.ucDataGridView1).BeginInit();
            base.SuspendLayout();
            this.panel1.BackColor = Color.FromArgb(0xa4, 0xc4, 0xeb);
            this.panel1.Controls.Add(this.btnPrint);
            this.panel1.Controls.Add(this.cbReportList);
            this.panel1.Controls.Add(this.label1);
            this.panel1.Dock = DockStyle.Top;
            this.panel1.Location = new Point(0, 0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x413, 0x1f);
            this.panel1.TabIndex = 3;
            this.btnPrint.AutoSize = true;
            this.btnPrint.BackColor = Color.White;
            this.btnPrint.FlatStyle = FlatStyle.Flat;
            this.btnPrint.Location = new Point(0x1b7, 4);
            this.btnPrint.Margin = new Padding(0);
            this.btnPrint.Name = "btnPrint";
            this.btnPrint.Size = new Size(0x4b, 0x18);
            this.btnPrint.TabIndex = 2;
            this.btnPrint.Text = "打印";
            this.btnPrint.UseVisualStyleBackColor = false;
            this.btnPrint.Click += new EventHandler(this.btnPrint_Click);
            this.cbReportList.BackColor = Color.White;
            this.cbReportList.DropDownStyle = ComboBoxStyle.DropDownList;
            this.cbReportList.FlatStyle = FlatStyle.Flat;
            this.cbReportList.FormattingEnabled = true;
            this.cbReportList.Location = new Point(0x5f, 6);
            this.cbReportList.Name = "cbReportList";
            this.cbReportList.Size = new Size(0x148, 20);
            this.cbReportList.TabIndex = 1;
            this.cbReportList.SelectedIndexChanged += new EventHandler(this.cbReportList_SelectedIndexChanged);
            this.label1.Location = new Point(3, 4);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x56, 0x17);
            this.label1.TabIndex = 0;
            this.label1.Text = "请选择报表";
            this.label1.TextAlign = ContentAlignment.MiddleCenter;
            this.panel3.BackColor = Color.White;
            this.panel3.Controls.Add(this.lbDate);
            this.panel3.Controls.Add(this.lbTel);
            this.panel3.Controls.Add(this.lbUser);
            this.panel3.Controls.Add(this.lbOrganName);
            this.panel3.Dock = DockStyle.Top;
            this.panel3.Location = new Point(0, 0x4f);
            this.panel3.Name = "panel3";
            this.panel3.Size = new Size(0x413, 0x1b);
            this.panel3.TabIndex = 5;
            this.lbDate.Dock = DockStyle.Right;
            this.lbDate.Font = new Font("宋体", 12f, FontStyle.Bold);
            this.lbDate.Location = new Point(0x344, 0);
            this.lbDate.Name = "lbDate";
            this.lbDate.Size = new Size(0xcf, 0x1b);
            this.lbDate.TabIndex = 2;
            this.lbDate.Text = "填表日期：";
            this.lbDate.TextAlign = ContentAlignment.MiddleLeft;
            this.lbTel.Dock = DockStyle.Left;
            this.lbTel.Font = new Font("宋体", 12f, FontStyle.Bold);
            this.lbTel.Location = new Point(0x2dc, 0);
            this.lbTel.Name = "lbTel";
            this.lbTel.Size = new Size(0xd9, 0x1b);
            this.lbTel.TabIndex = 3;
            this.lbTel.Text = "电话：";
            this.lbTel.TextAlign = ContentAlignment.MiddleLeft;
            this.lbUser.Dock = DockStyle.Left;
            this.lbUser.Font = new Font("宋体", 12f, FontStyle.Bold);
            this.lbUser.Location = new Point(0x1c7, 0);
            this.lbUser.Name = "lbUser";
            this.lbUser.Size = new Size(0x115, 0x1b);
            this.lbUser.TabIndex = 1;
            this.lbUser.Text = "填表人：";
            this.lbUser.TextAlign = ContentAlignment.MiddleLeft;
            this.lbOrganName.Dock = DockStyle.Left;
            this.lbOrganName.Font = new Font("宋体", 12f, FontStyle.Bold);
            this.lbOrganName.Location = new Point(0, 0);
            this.lbOrganName.Name = "lbOrganName";
            this.lbOrganName.Size = new Size(0x1c7, 0x1b);
            this.lbOrganName.TabIndex = 0;
            this.lbOrganName.Text = "填表单位（盖章）：";
            this.lbOrganName.TextAlign = ContentAlignment.MiddleLeft;
            this.lbTtile.BackColor = Color.White;
            this.lbTtile.Dock = DockStyle.Top;
            this.lbTtile.Font = new Font("宋体", 15.75f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lbTtile.Location = new Point(0, 0x1f);
            this.lbTtile.Name = "lbTtile";
            this.lbTtile.Size = new Size(0x413, 0x30);
            this.lbTtile.TabIndex = 6;
            this.lbTtile.Text = "lbTtile";
            this.lbTtile.TextAlign = ContentAlignment.MiddleCenter;
            this.ucDataGridView1.AllowUserToAddRows = false;
            this.ucDataGridView1.AllowUserToDeleteRows = false;
            this.ucDataGridView1.AllowUserToOrderColumns = true;
            this.ucDataGridView1.AllowUserToResizeRows = false;
            this.ucDataGridView1.BackgroundColor = Color.White;
            this.ucDataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.ucDataGridView1.Columns.AddRange(new DataGridViewColumn[] { 
                this.UserID, this.UserName, this.Sex, this.Birthplace, this.Nation, this.Politics, this.JoinPartDate, this.GraduationDate, this.GraduationSchoole, this.HighestEducation, this.Degree, this.Major, this.JoinWorkDate, this.IsOffice, this.RegistWay, this.RegistDay, 
                this.RegistFrom, this.RegistTo, this.RegistNo, this.RegistDate, this.RegistSummary, this.RegistRemark, this.RegistState, this.RegistType, this.IsHeighWith, this.JobPositionType, this.JobPositionName1, this.JobPositionName2, this.JobPositionDate1, this.JobPositionDate2, this.JobPositionNo, this.JobPositionDate, 
                this.JobPositionSummary, this.JobPositionRemark, this.AdminPosition, this.Position1, this.Position2, this.PositionLevel1, this.PositionLevel2, this.PositionStartDate1, this.PositionStartDate2, this.PositionEndDate1, this.PositionEndDate2, this.JobTitle1, this.JobTitle2, this.PositionNo1, this.PositionNo2, this.PositionDate1, 
                this.PositionDate2, this.PositionRemark1, this.PositionRemark2, this.IsLeave, this.LeaveReasion, this.LeaveDay, this.LeaveTo, this.LeaveNo, this.LeaveDate, this.LeaveRemark
             });
            style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            style.BackColor = SystemColors.Window;
            style.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style.ForeColor = SystemColors.ControlText;
            style.SelectionBackColor = SystemColors.Highlight;
            style.SelectionForeColor = SystemColors.ControlText;
            style.WrapMode = DataGridViewTriState.False;
            this.ucDataGridView1.DefaultCellStyle = style;
            this.ucDataGridView1.Dock = DockStyle.Fill;
            this.ucDataGridView1.GridColor = Color.FromArgb(0xd0, 0xd7, 0xe5);
            this.ucDataGridView1.HighlightSelectedColumnHeaders = false;
            this.ucDataGridView1.Location = new Point(0, 0x6a);
            this.ucDataGridView1.MultiSelect = false;
            this.ucDataGridView1.Name = "ucDataGridView1";
            this.ucDataGridView1.ReadOnly = true;
            this.ucDataGridView1.RowHeadersWidth = 50;
            this.ucDataGridView1.RowTemplate.Height = 0x17;
            this.ucDataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            this.ucDataGridView1.Size = new Size(0x413, 0x169);
            this.ucDataGridView1.TabIndex = 2;
            this.UserID.HeaderText = "UserID";
            this.UserID.Name = "UserID";
            this.UserID.ReadOnly = true;
            this.UserID.Visible = false;
            this.UserName.DataPropertyName = "UserName";
            this.UserName.HeaderText = "姓名";
            this.UserName.Name = "UserName";
            this.UserName.ReadOnly = true;
            this.Sex.HeaderText = "姓别";
            this.Sex.Name = "Sex";
            this.Sex.ReadOnly = true;
            this.Birthplace.HeaderText = "出生年月";
            this.Birthplace.Name = "Birthplace";
            this.Birthplace.ReadOnly = true;
            this.Nation.HeaderText = "民族";
            this.Nation.Name = "Nation";
            this.Nation.ReadOnly = true;
            this.Politics.HeaderText = "政治面貌";
            this.Politics.Name = "Politics";
            this.Politics.ReadOnly = true;
            this.JoinPartDate.HeaderText = "入党/团时间";
            this.JoinPartDate.Name = "JoinPartDate";
            this.JoinPartDate.ReadOnly = true;
            this.GraduationDate.HeaderText = "毕业时间";
            this.GraduationDate.Name = "GraduationDate";
            this.GraduationDate.ReadOnly = true;
            this.GraduationSchoole.HeaderText = "毕业学校";
            this.GraduationSchoole.Name = "GraduationSchoole";
            this.GraduationSchoole.ReadOnly = true;
            this.HighestEducation.HeaderText = "最高学历";
            this.HighestEducation.Name = "HighestEducation";
            this.HighestEducation.ReadOnly = true;
            this.Degree.HeaderText = "学位";
            this.Degree.Name = "Degree";
            this.Degree.ReadOnly = true;
            this.Major.HeaderText = "专业";
            this.Major.Name = "Major";
            this.Major.ReadOnly = true;
            this.JoinWorkDate.HeaderText = "参加工作时间";
            this.JoinWorkDate.Name = "JoinWorkDate";
            this.JoinWorkDate.ReadOnly = true;
            this.IsOffice.HeaderText = "编制类别";
            this.IsOffice.Name = "IsOffice";
            this.IsOffice.ReadOnly = true;
            this.RegistWay.HeaderText = "入编方式";
            this.RegistWay.Name = "RegistWay";
            this.RegistWay.ReadOnly = true;
            this.RegistDay.HeaderText = "入编时间";
            this.RegistDay.Name = "RegistDay";
            this.RegistDay.ReadOnly = true;
            this.RegistFrom.HeaderText = "入编来源";
            this.RegistFrom.Name = "RegistFrom";
            this.RegistFrom.ReadOnly = true;
            this.RegistTo.HeaderText = "现编单位";
            this.RegistTo.Name = "RegistTo";
            this.RegistTo.ReadOnly = true;
            this.RegistNo.HeaderText = "控编文号";
            this.RegistNo.Name = "RegistNo";
            this.RegistNo.ReadOnly = true;
            this.RegistDate.HeaderText = "下文时间";
            this.RegistDate.Name = "RegistDate";
            this.RegistDate.ReadOnly = true;
            this.RegistSummary.HeaderText = "入编摘要";
            this.RegistSummary.Name = "RegistSummary";
            this.RegistSummary.ReadOnly = true;
            this.RegistRemark.HeaderText = "入编备注";
            this.RegistRemark.Name = "RegistRemark";
            this.RegistRemark.ReadOnly = true;
            this.RegistState.HeaderText = "入编状态";
            this.RegistState.Name = "RegistState";
            this.RegistState.ReadOnly = true;
            this.RegistType.HeaderText = "入编类型";
            this.RegistType.Name = "RegistType";
            this.RegistType.ReadOnly = true;
            this.IsHeighWith.HeaderText = "是否高配";
            this.IsHeighWith.Name = "IsHeighWith";
            this.IsHeighWith.ReadOnly = true;
            this.JobPositionType.HeaderText = "职务类型";
            this.JobPositionType.Name = "JobPositionType";
            this.JobPositionType.ReadOnly = true;
            this.JobPositionName1.HeaderText = "职位1";
            this.JobPositionName1.Name = "JobPositionName1";
            this.JobPositionName1.ReadOnly = true;
            this.JobPositionName2.HeaderText = "职位2";
            this.JobPositionName2.Name = "JobPositionName2";
            this.JobPositionName2.ReadOnly = true;
            this.JobPositionDate1.HeaderText = "职务1工作时间";
            this.JobPositionDate1.Name = "JobPositionDate1";
            this.JobPositionDate1.ReadOnly = true;
            this.JobPositionDate2.HeaderText = "职务2工作时间";
            this.JobPositionDate2.Name = "JobPositionDate2";
            this.JobPositionDate2.ReadOnly = true;
            this.JobPositionNo.HeaderText = "文号";
            this.JobPositionNo.Name = "JobPositionNo";
            this.JobPositionNo.ReadOnly = true;
            this.JobPositionDate.HeaderText = "下文时间";
            this.JobPositionDate.Name = "JobPositionDate";
            this.JobPositionDate.ReadOnly = true;
            this.JobPositionSummary.HeaderText = "摘要";
            this.JobPositionSummary.Name = "JobPositionSummary";
            this.JobPositionSummary.ReadOnly = true;
            this.JobPositionRemark.HeaderText = "备注";
            this.JobPositionRemark.Name = "JobPositionRemark";
            this.JobPositionRemark.ReadOnly = true;
            this.AdminPosition.HeaderText = "行政职务";
            this.AdminPosition.Name = "AdminPosition";
            this.AdminPosition.ReadOnly = true;
            this.Position1.HeaderText = "岗位1";
            this.Position1.Name = "Position1";
            this.Position1.ReadOnly = true;
            this.Position2.HeaderText = "岗位2";
            this.Position2.Name = "Position2";
            this.Position2.ReadOnly = true;
            this.PositionLevel1.HeaderText = "岗位1等级";
            this.PositionLevel1.Name = "PositionLevel1";
            this.PositionLevel1.ReadOnly = true;
            this.PositionLevel2.HeaderText = "岗位2等级";
            this.PositionLevel2.Name = "PositionLevel2";
            this.PositionLevel2.ReadOnly = true;
            this.PositionStartDate1.HeaderText = "岗位1开始时间";
            this.PositionStartDate1.Name = "PositionStartDate1";
            this.PositionStartDate1.ReadOnly = true;
            this.PositionStartDate2.HeaderText = "岗位2开始时间";
            this.PositionStartDate2.Name = "PositionStartDate2";
            this.PositionStartDate2.ReadOnly = true;
            this.PositionEndDate1.HeaderText = "岗位1结束时间";
            this.PositionEndDate1.Name = "PositionEndDate1";
            this.PositionEndDate1.ReadOnly = true;
            this.PositionEndDate2.HeaderText = "岗位2结束时间";
            this.PositionEndDate2.Name = "PositionEndDate2";
            this.PositionEndDate2.ReadOnly = true;
            this.JobTitle1.HeaderText = "岗位1职称";
            this.JobTitle1.Name = "JobTitle1";
            this.JobTitle1.ReadOnly = true;
            this.JobTitle2.HeaderText = "岗位2职称";
            this.JobTitle2.Name = "JobTitle2";
            this.JobTitle2.ReadOnly = true;
            this.PositionNo1.HeaderText = "岗位1文号";
            this.PositionNo1.Name = "PositionNo1";
            this.PositionNo1.ReadOnly = true;
            this.PositionNo2.HeaderText = "岗位2文号";
            this.PositionNo2.Name = "PositionNo2";
            this.PositionNo2.ReadOnly = true;
            this.PositionDate1.HeaderText = "岗位1下文时间";
            this.PositionDate1.Name = "PositionDate1";
            this.PositionDate1.ReadOnly = true;
            this.PositionDate2.HeaderText = "岗位2下文时间";
            this.PositionDate2.Name = "PositionDate2";
            this.PositionDate2.ReadOnly = true;
            this.PositionRemark1.HeaderText = "岗位1摘要";
            this.PositionRemark1.Name = "PositionRemark1";
            this.PositionRemark1.ReadOnly = true;
            this.PositionRemark2.HeaderText = "岗位2摘要";
            this.PositionRemark2.Name = "PositionRemark2";
            this.PositionRemark2.ReadOnly = true;
            this.IsLeave.HeaderText = "是否离开";
            this.IsLeave.Name = "IsLeave";
            this.IsLeave.ReadOnly = true;
            this.LeaveReasion.HeaderText = "离开原因";
            this.LeaveReasion.Name = "LeaveReasion";
            this.LeaveReasion.ReadOnly = true;
            this.LeaveDay.HeaderText = "离开时间";
            this.LeaveDay.Name = "LeaveDay";
            this.LeaveDay.ReadOnly = true;
            this.LeaveTo.HeaderText = "去向";
            this.LeaveTo.Name = "LeaveTo";
            this.LeaveTo.ReadOnly = true;
            this.LeaveNo.HeaderText = "离开文号";
            this.LeaveNo.Name = "LeaveNo";
            this.LeaveNo.ReadOnly = true;
            this.LeaveDate.HeaderText = "下文时间";
            this.LeaveDate.Name = "LeaveDate";
            this.LeaveDate.ReadOnly = true;
            this.LeaveRemark.HeaderText = "摘要";
            this.LeaveRemark.Name = "LeaveRemark";
            this.LeaveRemark.ReadOnly = true;
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x413, 0x1d3);
            base.Controls.Add(this.ucDataGridView1);
            base.Controls.Add(this.panel3);
            base.Controls.Add(this.lbTtile);
            base.Controls.Add(this.panel1);
            base.Name = "FrmReport";
            this.Text = "FrmReport";
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            this.panel3.ResumeLayout(false);
            ((ISupportInitialize) this.ucDataGridView1).EndInit();
            base.ResumeLayout(false);
        }

        private void ReportDataBind()
        {
            this.report = this.reportList.FirstOrDefault<UserReport>(f => f.ReportID == int.Parse(this.cbReportList.SelectedValue.ToString()));
            if (this.report != null)
            {
                this.lbTtile.Text = this.organ.OrganName + this.report.ReportName;
                this.lbOrganName.Visible = this.report.ShowOrganName == 1;
                this.lbUser.Visible = this.report.ShowUserName == 1;
                this.lbTel.Visible = this.report.ShowUserTel == 1;
                this.lbDate.Visible = this.report.ShowDate == 1;
                this.ucDataGridView1.Columns.Clear();
                this.columnList = this.report.ShowColumns.Split(new char[] { ',' }).ToList<string>();
                using (List<string>.Enumerator enumerator = this.columnList.GetEnumerator())
                {
                    Func<DataGridViewColumn, bool> predicate = null;
                    string item;
                    while (enumerator.MoveNext())
                    {
                        item = enumerator.Current;
                        if (predicate == null)
                        {
                            predicate = f => f.Name == item;
                        }
                        DataGridViewColumn dataGridViewColumn = this.dgvColumnList.FirstOrDefault<DataGridViewColumn>(predicate);
                        if (dataGridViewColumn != null)
                        {
                            dataGridViewColumn.DataPropertyName = dataGridViewColumn.Name;
                            this.ucDataGridView1.Columns.Add(dataGridViewColumn);
                        }
                    }
                }
                this.userlist = this.userbll.GetList(this.report.SelectSql, this.OrganID);
                this.ucDataGridView1.DataSource = this.userlist;
            }
        }

        private class ColumnName
        {
            public string Name { get; set; }

            public string Text { get; set; }
        }
    }
}

